<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@ taglib prefix="spring" uri="http://www.springframework.org/tags"%>
<%@ taglib prefix="form" uri="http://www.springframework.org/tags/form"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<script type="text/javascript">
function deleteMemo(memo_no,p_num){
	if (confirm("정말 삭제 하시겠습니까??")){    //확인
		location.href='deleteMemo.do?memo_no='+memo_no+"&&p_num="+p_num;
	}
	return false;
}
</script>
<style type="text/css">
	p{
		font-family: "돋움";
		font-size: 12px;
		line-height: 20px;
		color: #000;
	}
	div.rounded{
		background-color:#FFFF99;
		line-height: 20px;
		width: 200px;
		padding: 10px;
		border:thin double #c90;
		-moz-border-radius-bottomleft:15px;
		-webkit-border-bottom-left-radius:15px;
		-moz-border-radius-topright:15px;
		-webkit-border-top-right-radius:15px;
	}
	fieldset ul li {
		margin: 0 0 9px 0;
		padding: 0;
	}	
	input[type="button"] {
		width: 120px;
		font-family: "맑은 고딕";
	}
	fieldset ul {
		line-height list-style: none;
		padding: 0;
		margin: 2px;
	}
</style>
<c:if test="${empty mlist}">
	등록된 메모가 없습니다.
</c:if>
<c:if test="${not empty mlist}">
<table>
<tr><td>
<c:forEach var="memo" items="${mlist }">
	<div id="div1" class="rounded" style="width: 450px;float: left">
			<fieldset>
			<ul>
				<li>
					<b for="name" style="color: navy;">작성자 : ${memo.memo_id}<b>　　&nbsp;
					<b style="float: right;">작성날짜 : ${memo.memo_date }</b>
				</li>
				<li>
					<b for="name" style="color: navy;">소속 주차장 : ${memo.memo_pname}<b>
				</li>
				<li>
				<c:if test="${memo.memo_no != userNum }">
					<textarea style="vertical-align: bottom;background-color: #FFFF99; resize:none" rows="3" cols="65" disabled>${memo.memo_content }</textarea>
				</c:if>
				<c:if test="${memo.memo_no == userNum }">
					<textarea style="vertical-align: bottom;background-color: #FFFF99; resize:none" rows="3" cols="65">${memo.memo_content }</textarea>
				</c:if>
				</li>
				<div align="center">
					<c:choose>
						<c:when test="${userLevel >= 3 || memo.memo_id == userId}">
							<input type="button" value="수정" style="width: 120px;height: 20px;background-color: yellow"
								 						onclick="location.href='updateMemo.do?memo_no=${memo.memo_no}'">
							<input type="button" value="삭제" style="width: 120px;height: 20px;background-color: yellow"
								 						onclick="deleteMemo(${memo.memo_no},${memo.p_num})">
						</c:when>
						<c:when test="${userLevel <= 2 || memo.memo_id != userId }">
							<input type="button" value="수정" style="width: 120px;height: 20px;background-color: gray">
							<input type="button" value="삭제" style="width: 120px;height: 20px;background-color: gray">
						</c:when>
						<c:otherwise>
						
						</c:otherwise>
					</c:choose>
				</div>
			</ul>
			</fieldset>
		</div>
	</c:forEach>
	</td></tr>
	<tr><td align="center">
	${pagingHtml }
	</td></tr>
	</table>
</c:if>
